package com.company.project.common.utils;

/**
 * 
 * Title: EnumAreaType.java  
 * Description:初赛参赛赛区     
 * @author LS  
 * @date 2021-2-19 15:20:16  
 * @version 1.0
 */
public enum EnumAreaType {

	Beijing("北方赛区(北京)", "1", "Beijing"), 
	Shanghai("华东赛区(上海)", "2", "Shanghai"), 
	Chongqing("西南赛区(重庆)", "3", "Chongqing"), 
	Shenzheng("华南及港澳赛区(深圳)", "4", "Shenzheng"), 
	Xian("西北赛区(西安)", "5", "Xian"), 
	Wuhan("华中赛区(武汉)", "6", "Wuhan"),
	Fuzhou("闽台赛区(福州)", "7", "Fuzhou");
	
	private String name;
	private String index;
	private String code;

	// 构造方法
	private EnumAreaType(String name, String index,String code) {
		this.name = name;
		this.index = index;
		this.code = code;
	}

	// 普通方法
	public static String getName(String index) {
		for (EnumAreaType c : EnumAreaType.values()) {
			if (c.getIndex().equals(index)) {
				return c.name;
			}
		}
		return null;
	}
	
	public static String getIndexByName(String name) {
		for (EnumAreaType c : EnumAreaType.values()) {
			if (c.getName().equals(name)) {
				return c.index;
			}
		}
		return null;
	}
	
	public static String getIndexByCode(String code) {
		for (EnumAreaType c : EnumAreaType.values()) {
			if (c.getCode().equals(code)) {
				return c.index;
			}
		}
		return null;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIndex() {
		return index;
	}

	public void setIndex(String index) {
		this.index = index;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
}
